# CC <e11907086@student.tuwien.ac.at>
# program name is $(PROG)
CFLAGS:= -Wall -std=c99 -pedantic -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_POSIX_C_SOURCE=200809L
CXX:= gcc
PROG:= cpair

LDFLAGS:=
LDFLAGS+= -lm

OBJS:= cpair.o main.o

all: $(PROG)

%.o: src/%.c
	$(CXX) $(CFLAGS) -c $<

$(PROG): $(OBJS)
	$(CXX) $(CFLAGS) -g $(OBJS) -o $(PROG) $(LDFLAGS)

install: all
	@echo installing executable file to ${DESTDIR}${PREFIX}/bin
	@mkdir -p ${DESTDIR}${PREFIX}/bin
	@cp -f ${PROG} ${DESTDIR}${PREFIX}/bin
	@chmod 755 ${DESTDIR}${PREFIX}/bin/${PROG}

uninstall:
	@echo removing executable file from ${DESTDIR}${PREFIX}/bin
	@rm -f ${DESTDIR}${PREFIX}/bin/${PROG}

clean:
	rm $(PROG) *.o